SERVER = server
CLIENT = client

ALLAPP = $(SERVER) $(CLIENT)

SRCS = $(wildcard ./*.c)
DEPS = $(SRCS:.c=.d)

OBJSER = sermain.o
OBJCLI = climain.o

CC = gcc
CFLAGS = -Wall
LDFLAGS =
LDLIBS =
RM = rm -rf


.SUFFIXES: .d
.c.d:
	$(CC) -MM $(CFLAGS) $< > $@

.PHONY: all
.PHONY: clean
.PHONY: distclean

all: $(ALLAPP)

-include $(DEPS)
dep: $(DEPS)

$(SERVER): $(OBJSER)
	$(CC) $(CFLAGS) $^ $(LDFLAGS) $(LDLIBS) -o $@

$(CLIENT): $(OBJCLI)
	$(CC) $(CFLAGS) $^ $(LDFLAGS) $(LDLIBS) -o $@

clean:
	$(RM) *.o *.d *~

distclean:
	$(RM) $(SERVER) $(CLIENT) *.o *.d *~
